<template>
<div>

  <input :type="visible? 'text': 'password'" placeholder="输入密码" >
  <button @click="onSwitch">眼睛</button>
</div>
</template>

<script>
export default {
    data() {
        return {
            visible:false,
        }
    },
    methods: {
        onSwitch(){
            this.visible=!this.visible;
        }
    },
}
</script>

<style>

</style>
